<?php
    $total = 0;
    foreach ($invoice as $item) {
        if (is_array($item)) {
            $total += @array_sum(Set::extract('{n}.value', $item));
        } else {
            $total += $item;
        }
    }
?>
<table>
    <tr>
        <td align="right">Komunalna taksa:</td>
        <td align="right"><?= currency_format($invoice['komunalna']) ?> <?= CURRENCY_SYMBOL ?></td>
    </tr>
    <tr>
        <td align="right">Porez na upotrebu vozila:</td>
        <td align="right"><?= currency_format($invoice['porez']) ?> <?= CURRENCY_SYMBOL ?></td>
    </tr>
    <tr>
        <td align="right">Auto Osiguranje:</td>
        <td align="right"><?= currency_format($invoice['osiguranje']) ?> <?= CURRENCY_SYMBOL ?></td>
    </tr>
    <tr>
        <td align="right">Registarska nalepnica:</td>
        <td align="right"><?= currency_format(@array_sum(Set::extract('{n}.value', $invoice['nalepnica']))) ?> <?= CURRENCY_SYMBOL ?></td>
    </tr>
    <tr>
        <td align="right">Saobraćajna dozvola:</td>
        <td align="right"><?= currency_format(@array_sum(Set::extract('{n}.value', $invoice['saobracajna']))) ?> <?= CURRENCY_SYMBOL ?></td>
    </tr>
    <tr>
        <td align="right">Registarske tablice:</td>
        <td align="right"><?= currency_format(@array_sum(Set::extract('{n}.value', $invoice['tablice']))) ?> <?= CURRENCY_SYMBOL ?></td>
    </tr>
    <tr class="total">
        <td align="right">UKUPNO:</td>
        <td align="right"><span style="color:#A01120">*</span><?= currency_format($total) ?> <?= CURRENCY_SYMBOL ?></td>
    </tr>
</table>
<p style="color:#A01120;text-align:left"><strong>* U cenu nisu uračunati provizija banke/pošte i cena tehničkog pregleda.</strong></p>
